/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.clientapi;

import com.jili.ubert.clientapi.until.AbstractWorker;
import com.jili.ubert.code.server2client.MsgResult;
import java.util.HashMap;

/**
 *
 * @author dragon
 */
final class SessionBucket {
    private final HashMap<Integer, AbstractWorker> sessionHandlerMap;
    public final void AcceptSession(int id,AbstractWorker hander){
        this.sessionHandlerMap.put(id, hander);
    }
    public final void OnDealSession(int id,MsgEntity msg){
        if (sessionHandlerMap.containsKey(id)) {
            sessionHandlerMap.get(id).Onhandler(msg);
            sessionHandlerMap.remove(id);
        }
    }
    public final void OnFaile(int id,MsgResult msg){
        if (sessionHandlerMap.containsKey(id)) {
            sessionHandlerMap.get(id).IsFalse(msg);
            sessionHandlerMap.remove(id);
        }
    }
    public SessionBucket(){sessionHandlerMap = new HashMap<>(2^6);}
    public SessionBucket(int contains){
        sessionHandlerMap = new HashMap<>(contains);
    }
}
